<!-- 任务执行情况 -->
<template>
  <el-dialog :title="typeOption[standardtype].title" :visible.sync="dialogVisible"
             @close="$emit('update:visible',false)"
             :close-on-click-modal="false">
    <div>
      <el-table
          ref="multipleTable"
          :data="arryList"
          tooltip-effect="dark"
          header-cell-class-name="table-text-c"
          height="400"
          cell-class-name="table-text-c">
        <el-table-column
            label="序列号"
            align="center"
            width="80"
            :key="1">
          <template slot-scope="scope">
            {{ scope.$index + 1 }}
          </template>
        </el-table-column>
        <el-table-column
            label="性别"
            align="center"
            prop="code"
            :key="2">
          <template slot-scope="scope">
            {{ scope.row.sex == 1 ? '男' : '女' }}
          </template>
        </el-table-column>
        <el-table-column
            label="年龄岁月"
            align="center"
            prop="month"
            :key="3"
            v-if="standardtype==1 || standardtype==2">
        </el-table-column>
        <el-table-column
            label="身高/cm"
            align="center"
            prop="height"
            :key="4"
            v-if="standardtype==3 || standardtype==4">
        </el-table-column>
        <el-table-column
            label="区间"
            align="center"
            :key="5">
          <template slot-scope="scope">
            {{ scope.row.min + '~' + scope.row.max }}
          </template>
        </el-table-column>
        <el-table-column
            label="标准"
            align="center"
            prop="type"
            :key="6">
        </el-table-column>
      </el-table>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="$emit('update:visible',false)" size="small">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>

export default {
  name: 'taskListDialog',
  props: ['visible', 'standardtype'],
  components: {},
  data() {
    return {
      dialogVisible: this.visible,
      arryList: [],
      total: 0,
      typeOption: {
        1: {title: '年龄身高标准', src: this.api.Developmental.standard.ageHeight}, // 年龄身高标准
        2: {title: '年龄体重标准', src: this.api.Developmental.standard.ageWeight}, // 年龄体重标准
        3: {title: '身高对应体重标准', src: this.api.Developmental.standard.heightWeight}, // 身高对应体重标准
        4: {title: '营养评价标准', src: this.api.Developmental.standard.obesity}, // 营养评价标准
      }
    }
  },
  created() {
  },
  methods: {
    InitFn() {
      this.$post(this.typeOption[this.standardtype].src, {}).then((response) => {
        this.arryList = response.list
        this.total = response.list.length
      }).catch((err) => {
        console.log(err)
      })
    },
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
      if (this.visible) {
        this.InitFn()
      } else {
        this.arryList = []
      }
    }
  },
  mounted() {

  }
}
</script>
